<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 对象解构获取console.log方法
    const {
      log: l
    } = console

    // 检测是否是数字，包括整数，小数
    l(/^\d+(|.\d+)$/.test('1.58977'))
  </script>
</body>

</html>